package org.hadoop.flume;
import org.apache.flume.Event;
import org.apache.flume.api.RpcClient;
import org.apache.flume.api.RpcClientFactory;
import org.apache.flume.event.EventBuilder;
import org.junit.Test;
import java.nio.charset.Charset;
public class ThriftClient {
    @Test
    public void test1() throws Exception {
        String host = "server101";
        int port = 4141;
        RpcClient client = RpcClientFactory.getThriftInstance(host, port);
        System.err.println(client);
        Event event = EventBuilder.withBody("Hello", Charset.forName("UTF-8"));
        client.append(event);
        client.close();//关闭
    }
}
